package com.highcom.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

//@Controller
//@ResponseBody
@RestController  // = @Controller+@ResponseBody
@RequestMapping("/user/")
public class UserController {

    //  /user/1
    //@RequestMapping(value = "/user/{id}",method = RequestMethod.GET)
//    @GetMapping(value = "/user/{id}")
//    //使用@PathVariable注解获取路径上配置的具名变量，该配置可以使用多次
//    public String restLoaction(@PathVariable Integer id){
//        System.out.println("restful is running ... " + id);
//        return "success.jsp";
//    }

    @GetMapping(value = "{id}")
    //使用@PathVariable注解获取路径上配置的具名变量，该配置可以使用多次
    public String get(@PathVariable Integer id){
        System.out.println("restful get is running ... " + id);
        return "success.jsp";
    }

    @PostMapping(value = "{id}")
    //使用@PathVariable注解获取路径上配置的具名变量，该配置可以使用多次
    public String post(@PathVariable Integer id){
        System.out.println("restful post is running ... " + id);
        return "success.jsp";
    }

    @PutMapping(value = "{id}")
    //使用@PathVariable注解获取路径上配置的具名变量，该配置可以使用多次
    public String put(@PathVariable Integer id){
        System.out.println("restful put is running ... " + id);
        return "success.jsp";
    }
    @DeleteMapping(value = "{id}")
    //使用@PathVariable注解获取路径上配置的具名变量，该配置可以使用多次
    public String delete(@PathVariable Integer id){
        System.out.println("restful delete is running ... " + id);
        return "success.jsp";
    }


}
